<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java基础教程 - 注释、关键字与变量</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .content-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
        }
        
        .content-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            padding: 1.5rem;
            overflow-x: auto;
            font-family: 'Consolas', 'Monaco', monospace;
            position: relative;
        }
        
        .code-block::before {
            content: 'Java';
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            font-size: 0.75rem;
            color: #858585;
            text-transform: uppercase;
        }
        
        h2 {
            position: relative;
            padding-left: 1rem;
        }
        
        h2::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 70%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        .highlight-box {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 1rem 1.5rem;
            border-radius: 8px;
            margin: 1rem 0;
            font-weight: 500;
        }
        
        .mermaid {
            text-align: center;
            margin: 2rem 0;
        }
        
        .floating-icon {
            animation: float 3s ease-in-out infinite;
        }
        
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
        }
        
        .section-divider {
            height: 2px;
            background: linear-gradient(to right, transparent, #e0e0e0, transparent);
            margin: 3rem 0;
        }
        
        .keyword-tag {
            display: inline-block;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.875rem;
            margin: 0.25rem;
            transition: all 0.3s ease;
        }
        
        .keyword-tag:hover {
            transform: scale(1.05);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 text-center">
            <div class="floating-icon inline-block mb-6">
                <i class="fas fa-code text-6xl"></i>
            </div>
            <h1 class="text-5xl font-bold mb-4">Java编程基础</h1>
            <p class="text-xl opacity-90 max-w-2xl mx-auto">掌握注释、关键字、标识符与变量的核心概念，为Java编程之旅打下坚实基础</p>
        </div>
    </div>

    <!-- Main Content -->
    <div class="container mx-auto px-6 py-12">
        <!-- 注释 Section -->
        <div class="content-card rounded-xl shadow-xl p-8 mb-8">
            <h2 class="text-3xl font-bold text-gray-800 mb-6">
                <i class="fas fa-comment-dots text-purple-600 mr-3"></i>1. 注释
            </h2>
            
            <div class="grid md:grid-cols-2 gap-6 mb-8">
                <div class="bg-gradient-to-br from-purple-50 to-pink-50 p-6 rounded-lg">
                    <h3 class="text-xl font-semibold mb-3 text-purple-800">
                        <i class="fas fa-bullseye mr-2"></i>学习目标
                    </h3>
                    <ul class="space-y-2 text-gray-700">
                        <li><i class="fas fa-check-circle text-green-500 mr-2"></i>了解Java中注释的作用和使用方法</li>
                        <li><i class="fas fa-check-circle text-green-500 mr-2"></i>学会正确使用单行注释和多行注释</li>
                    </ul>
                </div>
                
                <div class="bg-gradient-to-br from-blue-50 to-indigo-50 p-6 rounded-lg">
                    <h3 class="text-xl font-semibold mb-3 text-blue-800">
                        <i class="fas fa-lightbulb mr-2"></i>注释的作用
                    </h3>
                    <p class="text-gray-700">注释是程序中用于解释代码含义和提高代码可读性的文本。它不会被编译器编译，不会影响程序运行，但对代码维护和理解非常重要。</p>
                </div>
            </div>

            <div class="mb-8">
                <h3 class="text-2xl font-semibold mb-4 text-gray-800">
                    <i class="fas fa-code mr-2 text-purple-600"></i>注释类型详解
                </h3>
                
                <div class="space-y-6">
                    <div>
                        <h4 class="text-lg font-semibold mb-2 text-gray-700">单行注释</h4>
                        <p class="text-gray-600 mb-3">使用双斜杠（//）开头，从//开始到行尾都是注释内容</p>
                        <div class="code-block">
<pre>// 这是一个单行注释，用于解释下面这行代码的作用
int age = 25; // 定义一个整型变量 age 并赋值为 25</pre>
                        </div>
                    </div>
                    
                    <div>
                        <h4 class="text-lg font-semibold mb-2 text-gray-700">多行注释</h4>
                        <p class="text-gray-600 mb-3">以斜杠星号（/*）开始，以星号斜杠（*/）结束</p>
                        <div class="code-block">
<pre>/*
这是一个多行注释示例
用于对以下代码段进行注释
这段代码用于计算两个数的和并输出结果
*/
int num1 = 10;
int num2 = 20;
int sum = num1 + num2;
System.out.println("两个数的和为：" + sum);</pre>
                        </div>
                    </div>
                </div>
            </div>

            <div class="highlight-box">
                <i class="fas fa-info-circle mr-2"></i>
                <strong>最佳实践：</strong>注释应该简洁明了，及时更新，保持代码和注释的一致性
            </div>
        </div>

        <div class="section-divider"></div>

        <!-- 关键字 Section -->
        <div class="content-card rounded-xl shadow-xl p-8 mb-8">
            <h2 class="text-3xl font-bold text-gray-800 mb-6">
                <i class="fas fa-key text-purple-600 mr-3"></i>2. 关键字
            </h2>
            
            <div class="bg-gradient-to-r from-purple-100 to-pink-100 p-6 rounded-lg mb-8">
                <p class="text-lg text-gray-700">
                    <i class="fas fa-quote-left text-purple-600 mr-2"></i>
                    关键字是Java语言中预先定义好的具有特殊含义的单词，用于表示语言的语法结构或实现特定功能。它们不能用作标识符。
                    <i class="fas fa-quote-right text-purple-600 ml-2"></i>
                </p>
            </div>

            <div class="mb-8">
                <h3 class="text-2xl font-semibold mb-4 text-gray-800">常用关键字分类</h3>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="text-lg font-semibold mb-3 text-purple-700">
                            <i class="fas fa-database mr-2"></i>数据类型关键字
                        </h4>
                        <div class="flex flex-wrap">
                            <span class="keyword-tag">int</span>
                            <span class="keyword-tag">double</span>
                            <span class="keyword-tag">boolean</span>
                            <span class="keyword-tag">char</span>
                            <span class="keyword-tag">void</span>
                        </div>
                    </div>
                    
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="text-lg font-semibold mb-3 text-purple-700">
                            <i class="fas fa-code-branch mr-2"></i>控制流程关键字
                        </h4>
                        <div class="flex flex-wrap">
                            <span class="keyword-tag">if</span>
                            <span class="keyword-tag">else</span>
                            <span class="keyword-tag">for</span>
                            <span class="keyword-tag">while</span>
                            <span class="keyword-tag">break</span>
                            <span class="keyword-tag">continue</span>
                        </div>
                    </div>
                    
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="text-lg font-semibold mb-3 text-purple-700">
                            <i class="fas fa-cubes mr-2"></i>类和对象关键字
                        </h4>
                        <div class="flex flex-wrap">
                            <span class="keyword-tag">class</span>
                            <span class="keyword-tag">new</span>
                            <span class="keyword-tag">this</span>
                            <span class="keyword-tag">super</span>
                        </div>
                    </div>
                    
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="text-lg font-semibold mb-3 text-purple-700">
                            <i class="fas fa-shield-alt mr-2"></i>修饰符关键字
                        </h4>
                        <div class="flex flex-wrap">
                            <span class="keyword-tag">public</span>
                            <span class="keyword-tag">private</span>
                            <span class="keyword-tag">protected</span>
                            <span class="keyword-tag">static</span>
                            <span class="keyword-tag">final</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="section-divider"></div>

        <!-- 标识符 Section -->
        <div class="content-card rounded-xl shadow-xl p-8 mb-8">
            <h2 class="text-3xl font-bold text-gray-800 mb-6">
                <i class="fas fa-tag text-purple-600 mr-3"></i>3. 标识符
            </h2>
            
            <div class="bg-gradient-to-br from-indigo-50 to-purple-50 p-6 rounded-lg mb-8">
                <h3 class="text-xl font-semibold mb-3 text-indigo-800">什么是标识符？</h3>
                <p class="text-gray-700">标识符是在Java程序中用来标识变量、方法、类等各种元素的名称。它可以是任何由字母、数字、下划线和美元符号组成的序列。</p>
            </div>

            <div class="grid md:grid-cols-2 gap-6 mb-8">
                <div class="bg-white p-6 rounded-lg shadow-md">
                    <h4 class="text-lg font-semibold mb-3 text-green-700">
                        <i class="fas fa-check-circle mr-2"></i>命名规则
                    </h4>
                    <ul class="space-y-2 text-gray-700">
                        <li>• 必须以字母、下划线(_)或美元符($)开始</li>
                        <li>• 可包含字母、数字、下划线或美元符</li>
                        <li>• 区分大小写</li>
                        <li>• 不能是关键字或保留字</li>
                    </ul>
                </div>
                
                <div class="bg-white p-6 rounded-lg shadow-md">
                    <h4 class="text-lg font-semib